package day0814;

/**
 * @Author:galaxy_yan
 * @Date: 2022/8/15
 * @Time: 9:44
 * @Description
 * 作业标题(1707)
 * 求数组的平均值
 */
public class text5 {
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6,7,8,9};
        System.out.println(avg(arr));
    }

    private static double avg(int[] arr) {
        double sum=0;
        for (int i :
                arr) {
            sum+=i;
        }
        return sum/ arr.length;
    }
}
